package common.statusenum;

import java.util.HashMap;

/**
 * 合同服务状态
 *
 * @author yuanqinglong
 * @since 2020/9/8 9:50
 */
public enum ServiceStatusEnum {


    /**
     * .状态（10服务中、20试用中、30未生效、40已申请、50服务到期、55试用限速、60试用到期、70申请已处理）
     */
    IN_SERVICE(ServiceStatusEnum.IN_SERVICE_CODE, "服务中"),
    ON_TRIAL(ServiceStatusEnum.ON_TRIAL_CODE, "试用中"),
    NOT_ACTIVE(ServiceStatusEnum.NOT_ACTIVE_CODE, "未生效"),
    ALREADY_APPLIED(ServiceStatusEnum.ALREADY_APPLIED_CODE, "已申请"),
    SERVICE_EXPIRATION(ServiceStatusEnum.SERVICE_EXPIRATION_CODE, "服务到期"),
    LOW_SPEED(ServiceStatusEnum.LOW_SPEED_CODE, "限速"),
    TRIAL_EXPIRES(ServiceStatusEnum.TRIAL_EXPIRES_CODE, "试用到期"),
    APPLICATION_PROCESSED(ServiceStatusEnum.APPLICATION_PROCESSED_CODE, "申请已处理");

    public static final String IN_SERVICE_CODE = "10";
    public static final String ON_TRIAL_CODE = "20";
    public static final String NOT_ACTIVE_CODE = "30";
    public static final String ALREADY_APPLIED_CODE = "40";
    public static final String SERVICE_EXPIRATION_CODE = "50";
    public static final String LOW_SPEED_CODE = "55";
    public static final String TRIAL_EXPIRES_CODE = "60";
    public static final String APPLICATION_PROCESSED_CODE = "70";

    private final String code;
    private final String msg;

    ServiceStatusEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return this.code;
    }


    public String getMsg() {
        return this.msg;
    }

    static HashMap<String, String> map = new HashMap(32);

    static {
        for (ServiceStatusEnum value : ServiceStatusEnum.values()) {
            map.put(value.code, value.msg);
        }
    }

    public static String getMsgByCode(String code) {
        return map.get(code);
    }

}
